package com.tangw.spring.service.common;

import java.io.Serializable;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.tangw.spring.dao.common.BaseOperationDao;

@Transactional
public abstract class AbstractService<T extends Serializable> implements
		BaseOperationDao<T> {

	protected abstract BaseOperationDao<T> getDao();

	@Override
	public T findOne(Integer id) {
		return getDao().findOne(id);
	}

	@Override
	public List<T> findAll() {
		return getDao().findAll();
	}

	@Override
	public void create(T entity) {
		getDao().create(entity);
	}

	@Override
	public T update(T entity) {
		return getDao().update(entity);
	}

	@Override
	public void delete(T entity) {
		getDao().delete(entity);

	}

	@Override
	public void deleteById(Integer id) {
		getDao().deleteById(id);
	}
}
